home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96a.txt / 000087_icon-group-sender _Mon Apr 15 22:23:35 1996.msg < prev    next >
Internet Message Format  |  1996-09-05  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Mon, 15 Apr 1996 12:27:40 MST
  2. Date: Mon, 15 Apr 1996 22:23:35 +0300 (WET)
  3. From: Ehud Lamm <mslamm@pluto.mscc.huji.ac.il>
  4. To: rjhare@ed.ac.uk
  5. Cc: icon-group@cs.arizona.edu
  6. Subject: Re: random numbers...
  7. In-Reply-To: <9604150927.ab22893@uk.ac.ed.tattoo>
  8. Message-Id: <Pine.A32.3.91.960415222108.56899A-100000@pluto.mscc.huji.ac.il>
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: O
  13.  
  14.  
  15.  
  16. On 15 Apr 1996, R J Hare wrote:
  17.  
  18. > I'm writing a graphics program which requires that I perturb my x and
  19. > y values randomly by -1|0|1 before plotting the object at the new x and y.
  20. > There seem to be 2 obvious ways of doing this:
  21. > x := x-2+?3
  22. > y := y-2+?3
  23. > or:
  24. > x := x+?[-1,0,1]
  25. > y := y+?[-1,0,1]
  26.  
  27. The second option is clearly easier to read... 
  28. This is a good example of the powerful semantics of Icon compared to 
  29. regualr languages that would make you use the first solution.
  30.  
  31. Soory I can not comment about speed, but of hand it seems the elegent 
  32. solution is the slower one... :-)
  33.  
  34. Ehud Lamm     mslamm@pluto.mscc.huji.ac.il
  35.  
  36.